package com.kaishengit.util;

public class FileSize {
	public static String  getSize(long size){
		java.text.DecimalFormat df=new java.text.DecimalFormat("#.##"); 
		float size1 ;
		if(size>=1024 && 1024*1024>size){
			 size1 =  size/1024;
			return size1+"k";
		}
		if(size>=1024*1024 && size<1024*1024*1024){
			size1 =  size/1024/1024.0f;
			return df.format(size1)+"M";
		}
		if( size>=1024*1024*1024 && size<1024*1024*1024*1024){
			size1 = size/1024/1024.0f/1024;
			return df.format(size1)+"G";
		}
		/*if( size>=1024*1024*1024*1024 ){
			size1 = size/1024/1024/1024/1024;
			return size1+"T";
		}*/
		return size+"B";
		
	}
}


